/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package quanlythuvien;

import java.io.Serializable;
import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;
import java.util.logging.Level;
import java.util.logging.Logger;
import thuvien.ThuVienInterface;

/**
 *
 * @author Tuyen
 */
public class Server{
    public static void main(String[] args) {
        try {
            System.out.println("Server started!");
            ThuVienInterface thuvien=new ThuVienManager();
            LocateRegistry.createRegistry(1235);
            UnicastRemoteObject.exportObject(thuvien, 1235);
            Naming.rebind("rmi://localhost:1235/Nhom21", thuvien);
            System.out.println("Server is running!");
        } catch (RemoteException | MalformedURLException ex) {
            Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
        }
       
     
        
        
    }
}
